home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
ov143b.zip
/
DIALOG.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-01-04
|
3KB
|
114 lines
/* 004 28-May-87 dialog.c
Copyright (c) 1987 by Blue Sky Software. All rights reserved.
*/
#include <stdio.h>
#include "dialog.h"
#include "direct.h"
#include "strmem.h"
#ifdef LINT_ARGS /* this belongs somewhere else */
char * ALTCALL read_str(int, char *, int);
#else
char * ALTCALL read_str();
#endif
/***************************************************************************
D B X _ O P E N
**************************************************************************/
void ALTCALL
dbx_open(dbp,options) /* open a dialog box */
register D_BOX *dbp;
unsigned int options;
{
/* allocate a save area for the text under the box if the caller
wants the current video image saved */
if (options & DBX_SAVE)
dbp->save = (char *) Malloc((dbp->nrows+2) * (dbp->ncols+2) * 2);
else
dbp->save = NULL;
/* popup a window that is 2 rows and 2 columns larger than the one
the user wants. The extra space is for the border around the box. */
popup(dbp->row-1,dbp->col-1,dbp->nrows+2,dbp->ncols+2,dbp->save);
/* display a title if there is one */
if (dbp->title) {
disp_char_at(' ',dbp->row-1,dbp->col+1);
disp_str(dbp->title);
disp_char(' ');
}
}
/****************************************************************************
D B X _ C L O S E
***************************************************************************/
void ALTCALL
dbx_close(dbp) /* close a dialog box */
register D_BOX *dbp;
{
/* not much to it really, most of the work is done by popdwn() */
if (dbp->save) {
popdwn(dbp->row-1,dbp->col-1,dbp->nrows+2,dbp->ncols+2,dbp->save);
free(dbp->save);
}
}
/***************************************************************************
D B X _ R D F L D
***************************************************************************/
char *ALTCALL
dbx_rdfld(dbp,dfp) /* read a dialog box field value */
register D_BOX *dbp;
register D_FLD *dfp;
{
char *fldval;
dbx_goto(dbp,dfp->row,dfp->col); /* start of field */
return(read_str(dfp->len,dfp->value,dfp->pos)); /* read and return */
}
#ifndef DBX_MACROS /* only define following rtns if not defined as macros */
/***************************************************************************
D B X _ D I S P
**************************************************************************/
void ALTCALL
dbx_disp(dbp,s,ro,co) /* display text in a dialog box */
register D_BOX *dbp;
char *s;
int ro, co;
{
disp_str_at(s,dbp->row+ro,dbp->col+co);
}
/***************************************************************************
D B X _ G O T O
***************************************************************************/
void ALTCALL
dbx_goto(dbp,ro,co) /* goto a position in dialog box */
register D_BOX *dbp;
int ro,co;
{
gotorc(dbp->row+ro,dbp->col+co);
}
#endif /* ifndef DBX_MACROS */